<?php
namespace slinks\extensions\twig\core;
/**
 * Description of FileSystemLoader
 *
 * @author navid
 * @Service('TwigDefaultFileSystemLoader')
 * @Scope(public=false)
 * @Argument('%twig.template.dirs%')
 */
class FileSystemLoader extends \Twig_Loader_Filesystem implements ITwigTemplateLoader{
    
    private $templateSuffix = 'twig';
    
    /**
     * Constructor.
     *
     * @param string|array $paths A path or an array of paths where to look for templates
     * 
     */
    public function __construct($paths){
        parent::__construct($paths);
    }
    
    /**
     * **** Overrrided From base class to remove directory checks. Since multiple loaders may be available and directories could be configured by plugins if desired. *****
     * 
     * Sets the paths where templates are stored.
     *
     * @param string|array $paths A path or an array of paths where to look for templates
     */
    public function setPaths($paths)
    {
        // invalidate the cache
        $this->cache = array();

        if (!is_array($paths)) {
            $this->paths = array($paths);
        }else{
            $this->paths = $paths;
        }
    }
    
    
    public function getTemplateSuffix() {
        return $this->templateSuffix;
    }
    
    public function setTemplateSuffix($templateSuffix) {
        $this->templateSuffix = $templateSuffix;
    }

}
